package com.agileboot.domain.system.dict.dto;

import cn.hutool.core.bean.BeanUtil;
import com.agileboot.domain.common.cache.CacheCenter;
import com.agileboot.domain.system.dict.db.SysDictTypeEntity;
import com.agileboot.domain.system.user.db.SysUserEntity;
import lombok.Data;

import java.util.Date;

@Data
public class DictTypeDTO {

    public DictTypeDTO(SysDictTypeEntity entity){
        if(entity != null){
            BeanUtil.copyProperties(entity, this);
        }
        SysUserEntity cacheUser = CacheCenter.userCache.getObjectById(entity.getCreatorId());
        if (cacheUser != null) {
            this.creatorName = cacheUser.getUsername();
        }
    }

    private Long dictId;

    private String dictName;

    private  String dictType;

    private Integer status;

    private String remark;

    private Date createTime;

    private Date updateTime;

    private String creatorName;
}
